<?php /* Smarty version 2.6.26, created on 2013-04-25 14:13:17
         compiled from minsshopshop_form.html */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'escape', 'minsshopshop_form.html', 182, false),array('modifier', 'date_format', 'minsshopshop_form.html', 195, false),array('function', 'html_options', 'minsshopshop_form.html', 238, false),)), $this); ?>
<?php echo '<?xml'; ?>
 version="1.0" encoding="utf-8"<?php echo '?>'; ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<title>コントロールパネル</title>
		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/ui-lightness/ui.all.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/ui-lightness/jquery-ui-1.7.3.custom.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/dialog.css" type="text/css" />
		
		<script src="assets/scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
		<script src="assets/scripts/jquery-ui-1.7.3.custom.min.js" type="text/javascript"></script>
		<script src="assets/scripts/ui/ui.dialog.js" type="text/javascript"></script>
		
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>
		<script type="text/javascript" src="./tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
		<script type="text/javascript" src="./assets/scripts/editor.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.datepicker.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		
		<script type="text/javascript" src="./assets/scripts/search.js"></script>

		<script type="text/javascript">
		$(function() {
			$('.message').fadeIn("slow");
			$('.btn_regist').click(function(){
				if( confirm('登録してよろしいですか？') ){
					document.fm.mode.value = 'input';
					document.fm.submit();
				}
			});
			
			$('.btn_update').click(function(){
				if( confirm('更新してよろしいですか？') ){
					document.fm.mode.value = 'input';
					document.fm.submit();
				}
			});
			$('.btn_return').click(function(){
				location.href = "minsshopshop_index.php?hist=2";
			});
			$('.tddel').live('click',function(){
				$(this).closest('tr').remove();
				//$('#p_count').val(get_class_sum('nper'));
				//$('#n_count').val(get_class_sum('nnum'));
			});
			
			$('.btn_search_muti_ins_shopw').click(function(){
				var theValue = "";
				gMutiObj = this.id;
				var urlPara = makeMutiSearchURL( gMutiObj, theValue );
				//urlPara = urlPara + "&w=" + document.fm.w.value ; 
				$("#dialogmutiins").load( urlPara ).dialog({
					modal:true
				}); 
				$('#dialogmutiins').dialog('open');
				//iii = iii + 1;
				//li_add(this.id,iii, "inVal")
			});
		});
		
		function setSS( valcd, valnm ) {
			document.fm.shop_cd.value = valcd;
			document.fm.shop_name.value = valnm;			
			$('#dialog').dialog("close");
		}

		function li_add( inID, inVal ,inConums ,inPattern ,inPatternnm,inAdnums ,inAmemo ,inMemo ) {
			//alert( inID.replace(/'/g, "&#39;") );
			theid = inID.replace(/'/g, "&#39;");
			theNm = inVal.replace(/'/g, "&#39;");
			if (checkNames(inID)) {
				var strHtml = '<li id="a' + inID +'" class="item_li"> <a href="#"  style="color:red" class="li_del" >X</a>&nbsp;&nbsp;'+ inID + '&nbsp;&nbsp;' + inVal;
				strHtml = strHtml + "<input type='hidden' value='" + theid + "'  name ='ins_shop_cd_ul[]'>";
				strHtml = strHtml + "<input type='hidden' value='" + theNm + "' name ='ins_shop_name_ul[]'>";
				strHtml = strHtml + "<input type='hidden' value='" + inConums + "' name ='insert_conums_ul[]'>";
				strHtml = strHtml + "<input type='hidden' value='" + inPattern + "' name ='area_pattern_cd_ul[]'>";
				strHtml = strHtml + "<input type='hidden' value='" + inPatternnm + "' name ='area_pattern_name_ul[]'>";
				strHtml = strHtml + "<input type='hidden' value='" + inAdnums + "' name ='area_adnums_ul[]'>";
				strHtml = strHtml + "<input type='hidden' value='" + inAmemo + "' name ='area_memo_ul[]'>";
				strHtml = strHtml + "<input type='hidden' value='" + inMemo + "' name ='memo_ul[]'>";
				strHtml = strHtml + '</li>';
				$("#pop_ul").append(strHtml);
			}
		}
		function chkWeek() {
			var weekid = $("#matrix_cd").val() ;
			if (weekid.length == 0){
				alert("週を選択してください");
				return false;
			 }
			return true;
		}
		
		var g_shop_ul_to_grid = true ;
		function tr_add(vid, vname, inConums ,inPattern ,inPatternNm ,inAdnums ,inAmemo ,inMemo ) {
			var table = $('#table_insshop');
			var str = '<tr><td> <input type="text" name="ins_shop_cd[]" class="dtext"  value="'+ vid +'"  readonly/></td>'
			+ '<td> <input type="text" name="ins_shop_name[]" class="dtext"  value="'+ vname +'"  readonly/></td>'
			+ '<td> <input type="text" name="insert_conums[]" class="text"  value="'+ inConums +'"  /></td>'
			+ '<td> <select name="area_disp_ng"><option value="0" label="有効" selected>有効</option><option value="1" label="無効">無効</option>	</select></td>'
			+ '<td> <input type="text" name="area_pattern_name[]" class="dtext"  value="'+ inPatternNm +'"  readonly/>'
			+ '<input type="hidden"  name ="area_pattern_cd[]" value="'+ inPattern +'"></td>'
			+ '<td> <input type="text" name="area_adnums[]" class="text"  value="'+ inAdnums +'"  /></td>'
			+ '<td> <input type="text" name="area_memo[]" class="text"  value="'+ inAmemo +'"  /></td>'
			+ '<td> <input type="text" name="memo[]" class="text"  value="'+ inMemo +'"  /></td>'
			+ '<td> <a href="#" class="tddel">[削除]</a></td></tr>';
			$(table).append(str);
		}

		function copy_shop_pop_ul_to_grid() {
			var cdsul   = document.getElementsByName( 'ins_shop_cd_ul[]');
			var cdarr   = new Array();
			$.each(cdsul, function(i,val){
				
				cdarr[i] = val.value;
			}); 
			cdsul   = document.getElementsByName( 'insert_conums_ul[]');
			var conumsarr   = new Array();
			$.each(cdsul, function(i,val){
				conumsarr[i] = val.value;
			}); 
			cdsul   = document.getElementsByName('area_pattern_cd_ul[]');
			var patternarr   = new Array();
			$.each(cdsul, function(i,val){
				patternarr[i] = val.value;
			}); 

			cdsul   = document.getElementsByName('area_pattern_name_ul[]');
			var patternnmarr   = new Array();
			$.each(cdsul, function(i,val){
				patternnmarr[i] = val.value;
			}); 
			cdsul   = document.getElementsByName( 'area_adnums_ul[]');
			var adnumsarr   = new Array();
			$.each(cdsul, function(i,val){
				adnumsarr[i] = val.value;
			}); 
			cdsul   = document.getElementsByName( 'area_memo_ul[]');
			var amemoarr   = new Array();
			$.each(cdsul, function(i,val){
				amemoarr[i] = val.value;
			}); 
			
			cdsul   = document.getElementsByName( 'memo_ul[]');
			var memoarr   = new Array();
			$.each(cdsul, function(i,val){
				memoarr[i] = val.value;
			}); 

			var namesul = document.getElementsByName('ins_shop_name_ul[]');
			//var html = $("#table_insshop tr:last").html();
            //html = "<tr>" + html + "</tr>";
           // $("#table_insshop tr:last").remove();
			$.each(namesul, function(i,val){
				tr_add(cdarr[i], val.value,  conumsarr[i], patternarr[i], patternnmarr[i], adnumsarr[i], amemoarr[i], memoarr[i] );
			}); 
			
			

			//$("#table_insshop").append(html);
		}
		</script>
	</head>
	<body id="">
<?php echo $this->_tpl_vars['menu']; ?>

<?php echo $this->_tpl_vars['logout']; ?>

		<div id="container"><div class="wrapper">
			<h2>販売店紐付けマスター管理</h2>
			<ul class="submenu clearfix">
				<li>販売店紐付け情報一覧</li>
			</ul>
			<h3>販売店紐付け情報<?php if ($this->_tpl_vars['forms']['id'] == ''): ?>登録<?php else: ?>更新<?php endif; ?><?php if ($this->_tpl_vars['phase'] == 'complete'): ?>完了<?php endif; ?></h3>
<?php if ($this->_tpl_vars['phase'] == 'input'): ?>
			<p class="message">内容を確認し、<?php if ($this->_tpl_vars['forms']['id'] == ''): ?>登録<?php else: ?>更新<?php endif; ?>ボタンをクリックしてください。</p>
			<form name="fm" action="minsshopshop_form.php?w=<?php echo ((is_array($_tmp=$this->_tpl_vars['forms']['w'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
" method="post">
				<table class="formTable">
					<tbody>
						<tr><th>※週名/折込日</th>
							<td>
								<input type="text" name="dispw" class="dtext" value="<?php echo ((is_array($_tmp=$this->_tpl_vars['forms']['dispw'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
" readonly="readonly" />
								<input type="hidden" name="w"  value="<?php echo ((is_array($_tmp=$this->_tpl_vars['forms']['w'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
" />
							</td>
						</tr>
<?php if ($this->_tpl_vars['forms']['id'] != ''): ?>
						<tr>
							<th>更新日時</th>
							<td>
								<?php echo ((is_array($_tmp=$this->_tpl_vars['forms']['u_time'])) ? $this->_run_mod_handler('date_format', true, $_tmp, "%Y/%m/%d %H:%M") : smarty_modifier_date_format($_tmp, "%Y/%m/%d %H:%M")); ?>
<input type="hidden" name="u_time" value="<?php echo $this->_tpl_vars['forms']['u_time']; ?>
" />
							</td>
						</tr>
						<tr>
							<th>更新者</th>
							<td>
								<?php echo $this->_tpl_vars['forms']['m_user_name']; ?>
<input type="hidden" name="m_user_name" value="<?php echo $this->_tpl_vars['forms']['m_user_name']; ?>
" />
							</td>
						</tr>
						<tr>
							<th>※店舗</th>
							<td>
								<?php echo ((is_array($_tmp=$this->_tpl_vars['forms']['shop_cd'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
&nbsp;&nbsp;<?php echo ((is_array($_tmp=$this->_tpl_vars['forms']['shop_name'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>

								<input type="hidden" name="shop_name"  value="<?php echo ((is_array($_tmp=$this->_tpl_vars['forms']['shop_name'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
" />
								<input type="hidden" name="shop_cd"    value="<?php echo ((is_array($_tmp=$this->_tpl_vars['forms']['shop_cd'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
" />
							</td>
						</tr>
<?php else: ?>
						<tr>
							<th>※店舗</th>
							<td>
								<input type="text" name="shop_name" class="text" value="<?php echo ((is_array($_tmp=$this->_tpl_vars['forms']['shop_name'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
" readonly="readonly" />
								<input type="hidden" name="shop_cd"  value="<?php echo ((is_array($_tmp=$this->_tpl_vars['forms']['shop_cd'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
" />
								<button type="button" id="shop" class="btn_search" rel="shop"><span>参照</span></button>
								<?php echo $this->_tpl_vars['err']['shop_cd']; ?>
 
							</td>
						</tr>
<?php endif; ?>
						<tr>
							<th>※販売店</th>
							<td>
							<button type="button" id="ins_shop_patt" class="btn_search_muti_ins_shopw" ><span>販売店追加</span></button>
							<?php echo $this->_tpl_vars['err']['insert_conums']; ?>
&nbsp;&nbsp; <?php echo $this->_tpl_vars['err']['area_adnums']; ?>
 <br>
<table class="formTable" id = "table_insshop" >
<tr><th ><span>GEOコード</span></th><th><span>販売店名</span></th><th><span>折込会社部数</span></th>
<th ><span>地域広告紐付</span></th><th><span>地域新聞名</span></th><th><span>地域広告部数</span></th>
<th ><span>地域広告備考</span></th><th><span>備考</span></th><th><span>操作</span></th>
</tr>
<?php $_from = $this->_tpl_vars['forms']['mutirow']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['member'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['member']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['v']):
        $this->_foreach['member']['iteration']++;
?>
<tr>
<td> <input type="text" name="ins_shop_cd[]" class="dtext"  value="<?php echo $this->_tpl_vars['v']['ins_shop_cd']; ?>
"  readonly/></td>
<td> <input type="text" name="ins_shop_name[]" class="dtext"  value="<?php echo $this->_tpl_vars['v']['ins_shop_name']; ?>
"  readonly/></td>
<td> <input type="text" name="insert_conums[]" class="text"  value="<?php echo $this->_tpl_vars['v']['insert_conums']; ?>
"  /></td>
<td> <?php echo smarty_function_html_options(array('name' => 'area_disp_ng[]','options' => $this->_tpl_vars['areaflags'],'selected' => $this->_tpl_vars['v']['area_disp_ng'],'separator' => '&nbsp;'), $this);?>
</td>
<td> <input type="text" name="area_pattern_name[]" class="dtext"  value="<?php echo $this->_tpl_vars['v']['area_pattern_name']; ?>
"  readonly/>
<input type="hidden" value="<?php echo $this->_tpl_vars['v']['area_pattern_cd']; ?>
" name ="area_pattern_cd[]"></td>
<td> <input type="text" name="area_adnums[]" class="text"  value="<?php echo $this->_tpl_vars['v']['area_adnums']; ?>
"  /></td>
<td> <input type="text" name="area_memo[]" class="text"  value="<?php echo $this->_tpl_vars['v']['area_memo']; ?>
"  /></td>
<td> <input type="text" name="memo[]" class="text"  value="<?php echo $this->_tpl_vars['v']['memo']; ?>
"  /></td>
<td> <a href="#" class="tddel">[削除]</a></td>
</tr>
<?php endforeach; endif; unset($_from); ?>
</table>
								 <?php echo $this->_tpl_vars['err']['ins_shop_cd']; ?>

							</td>
						</tr>
<?php if ($this->_tpl_vars['forms']['id'] != ''): ?>
						<tr>
							<th>非表示設定</th>
							<td style = "vertical-align:middle">
 <?php if ($this->_tpl_vars['forms']['disp_ng'] == '1'): ?>
								<label><input class="chkinput" type="checkbox" name="disp_ng" value="1" checked /> 非表示にする</label>
 <?php else: ?>
								<label><input class="chkinput" type="checkbox" name="disp_ng" value="1"  /> 非表示にする</label>
 <?php endif; ?>
							</td>
						</tr>
 <?php endif; ?>
					</tbody>
				</table>
				<p class="button">
				<button type="button" class="btn_return" class="submit"><span>戻る</span></button>
<?php if ($this->_tpl_vars['forms']['id'] != ''): ?>
					<button type="button" class="btn_update" class="submit"><span>更新</span></button>
<?php else: ?>
					<button type="button" class="btn_regist" class="submit"><span>登録</span></button>
<?php endif; ?>
				</p>
				<input type="hidden" name="id" value="<?php echo $this->_tpl_vars['forms']['id']; ?>
" />
				<input type="hidden" name="mode" value="" />
			</form>

<div id="dialog" >
</div>
 <div id="dialogmutiins" >
</div>

<?php endif; ?>

<?php if ($this->_tpl_vars['phase'] == 'complete'): ?>
			<p class="message"><?php echo $this->_tpl_vars['message']; ?>
</p>
			<ul>
<?php if ($this->_tpl_vars['forms']['id'] != ''): ?>
				<li>>> <a href="minsshopshop_index.php?hist=2">一覧ページに戻る</a></li>
<?php else: ?>
				<li>>> <a href="minsshopshop_index.php">一覧ページに戻る</a></li>
<?php endif; ?>
				<li>>> <a href="minsshopshop_form.php?w=<?php echo ((is_array($_tmp=$this->_tpl_vars['forms']['w'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
">新規登録</a></li>
<?php if ($this->_tpl_vars['forms']['id'] != ''): ?>
				<li>>> <a href="minsshopshop_form.php?id=<?php echo $this->_tpl_vars['forms']['id']; ?>
&w=<?php echo ((is_array($_tmp=$this->_tpl_vars['forms']['w'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
">更新</a></li>
<?php endif; ?>
			</ul>
<?php endif; ?>

		</div></div>
		<?php echo $this->_tpl_vars['footer']; ?>

	</body>
</html>